class Solution {
public:
    int distanceBetweenBusStops(vector<int>& distance, int start, int destination)
    {
        int stod = 0;
        for (int i = min(start, destination); i < max(start, destination); i++)
            stod += distance[i];
        int dtos = accumulate(distance.begin() + max(start, destination), distance.end(), 0);
        for (int i = 0; i < min(start, destination); i++)
            dtos += distance[i];
        return min(stod, dtos);
    }
};